Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@unified-latex/unified-latex-util-trim
Advanced tools
Functions for modifying a unified-latex AST
Functions to help modify a unified-latex
Abstract Syntax Tree (AST).
If you want to remove whitespace from the ends of an array of nodes.
Note that whitespace can come from a Ast.Whitespace
node or from an
Ast.Comment
node that has leading whitespace. These functions take care
to deal with both situations.
npm install @unified-latex/unified-latex-util-trim
This package contains both esm and commonjs exports. To explicitly access the esm export,
import the .js
file. To explicitly access the commonjs export, import the .cjs
file.
unifiedLatexTrimEnvironmentContents
Unified plugin to trim the whitespace from the start/end of any environments, including math environments.
unified().use(unifiedLatexTrimEnvironmentContents)
Plugin<void[], Ast.Root, Ast.Root>
function unifiedLatexTrimEnvironmentContents(): (tree: Ast.Root) => void;
unifiedLatexTrimRoot
Unified plugin to trim the whitespace from the start/end of the root element.
unified().use(unifiedLatexTrimRoot)
Plugin<void[], Ast.Root, Ast.Root>
function unifiedLatexTrimRoot(): (tree: Ast.Root) => void;
hasWhitespaceEquivalent(nodes)
Returns whether the array has whitespace at the start/end. Comments with leadingWhitespace === true
are counted as whitespace. Other comments are ignored.
function hasWhitespaceEquivalent(nodes: Ast.Node[]): {
start: boolean;
end: boolean;
};
Parameters
Param | Type |
---|---|
nodes | Ast.Node[] |
trim(nodes)
Trims whitespace and parbreaks from the start and end of an array. The number of trimmed nodes is returned. Special care is taken to preserve comments, though any whitespace before the first comment(s) or after the last comment(s) is trimmed.
function trim(nodes: Ast.Node[]): { trimmedStart: number; trimmedEnd: number };
Parameters
Param | Type |
---|---|
nodes | Ast.Node[] |
trimEnd(nodes)
Trim whitespace and parbreaks from the right of an array.
function trimEnd(nodes: Ast.Node[]): { trimmedEnd: number };
Parameters
Param | Type |
---|---|
nodes | Ast.Node[] |
trimStart(nodes)
Trim whitespace and parbreaks from the left of an array.
function trimStart(nodes: Ast.Node[]): { trimmedStart: number };
Parameters
Param | Type |
---|---|
nodes | Ast.Node[] |
v1.8.0
amsart
macros\o y
produces øy
instead of ø y
\hyphenation
FAQs
Functions for modifying a unified-latex AST
We found that @unified-latex/unified-latex-util-trim demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.